﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebCinesItech.Persistencia;
using WebCinesItech.Dominio;

namespace WebCinesItech
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnlogin_Click(object sender, EventArgs e)
        {
            string usu = txtlogin.Text.Trim();
            string psw = txtcontras.Text.Trim();
            UsuarioDAO objDAO = new UsuarioDAO();
            if (usu != "" && psw != "")
            {
                BE_Usuario objBE = new BE_Usuario (); 
                objBE.Usuario = usu;
                objBE.Password = psw;
                string res = objDAO.LoguearUsuario(objBE);
                if (res != "")
                {
                    Session["Usuario"] = res;
                    Response.Redirect("frmReserva.aspx");
                }
                else {
                    lblrespuesta.Text= "Usuario Incorrecto";
                }
            }
            else {
                if (usu == "")
                {
                    lbluser.Text = "Ingrese Usuario";
                }
                if (psw == "") {
                    lblpass.Text = "Ingrese Password";
                }
            }
           
        }
    }
}